package com.liulishuo.demo.filedownloaderapplication;
import ohos.agp.utils.Color;
import ohos.event.notification.NotificationHelper;
import ohos.event.notification.NotificationRequest;
import ohos.event.notification.NotificationSlot;
import ohos.rpc.RemoteException;

public class Utils {
    public static NotificationSlot createNotificationChannel(
            String channelId,
            String channelName
    ) {
        NotificationSlot slot = new NotificationSlot(channelId, channelName, NotificationSlot.LEVEL_LOW);
        slot.setEnableVibration(true);
        slot.setLockscreenVisibleness(NotificationRequest.VISIBLENESS_TYPE_PUBLIC);//设置锁屏模式
        slot.setEnableLight(true); // 设置开启呼吸灯提醒
        slot.setLedLightColor(Color.RED.getValue());// 设置呼吸灯的提醒颜色
        try {
            NotificationHelper.addNotificationSlot(slot);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return slot;
    }

    public static void deleteNotificationChannel(int channelId) {
        try {
            NotificationHelper.cancelNotification(channelId);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}
